package week13;

/**
 * Created by dell on 2017/5/17.
 */
public class Book {

    private String name;
    private String writer;
    private String outer;
    private int date;

    public Book(String name, String writer, String outer, int date){
        this.name = name;
        this.writer = writer;
        this.outer = outer;
        this.date = date;
    }

    public Book(String name, String writer){
        this(name, writer, "人民教育出版社", 201501);
    }
    public Book(String outer, int date){
        this("密码学" ,"张三",outer, date);
    }
    public Book(){
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Book book = (Book) o;

        if (date != book.date) return false;
        if (name != null ? !name.equals(book.name) : book.name != null) return false;
        if (writer != null ? !writer.equals(book.writer) : book.writer != null) return false;
        return outer != null ? outer.equals(book.outer) : book.outer == null;

    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (writer != null ? writer.hashCode() : 0);
        result = 31 * result + (outer != null ? outer.hashCode() : 0);
        result = 31 * result + date;
        return result;
    }

    @Override
    public String toString() {
        return "Book{" +
                "name='" + name + '\'' +
                ", writer='" + writer + '\'' +
                ", outer='" + outer + '\'' +
                ", date=" + date +
                '}';
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getWriter() {
        return writer;
    }

    public void setWriter(String writer) {
        this.writer = writer;
    }

    public String getOuter() {
        return outer;
    }

    public void setOuter(String outer) {
        this.outer = outer;
    }

    public int getDate() {
        return date;
    }

    public void setDate(int date) {
        this.date = date;
    }




}
